package com.example.demo.mapper;

import com.example.demo.model.po.UserPo;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;


@Mapper
@Component
public interface UserMapper {


    @Select("select *from user where account=#{account}")
    UserPo selectByAccount(String account);


    @Delete("delete from user where account=#{account}")
    int deleteByAccount(String account);

    @Update("update user set name=#{name},age=#{age},gender=#{gender},addr=#{addr},phone=#{phone}where user_id=#{userId}")
    int updateBy(UserPo userPo);

    @Select("select *from user")
    List<UserPo> selectALlUser();

    @Insert("insert into user(account,password,name,age,gender,addr,phone) values(#{account},#{password},#{name},#{age},#{gender},#{addr},#{phone})")
    int insertUser(UserPo userPo);

    @Delete("delete from user where user_id=#{userId}")
    int deleteUserById(int userId);
}
